/**
 * Copyright 2025 Adobe. All rights reserved.
 * This file is licensed to you under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License. You may obtain a copy
 * of the License at http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software distributed under
 * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
 * OF ANY KIND, either express or implied. See the License for the specific language
 * governing permissions and limitations under the License.
 */

@import url("./spectrum-combobox.css");
@import url("./combobox-overrides.css");

:host {
    display: inline-flex;
    flex-wrap: wrap;
}

:host([label-position="inline-start"]) {
    flex-wrap: nowrap;
}

:host([readonly]) sp-picker-button {
    visibility: hidden;
    pointer-events: none;
}

sp-field-label {
    display: block;
    width: 100%;
}

:host([label-position="inline-start"]) sp-field-label {
    width: auto;
}

sp-popover {
    max-block-size: var(--sp-combobox-popover-max-block-size);
}

sp-popover:not(sp-overlay sp-popover) {
    display: none;
}

.icon {
    margin: 0;
}

/* TODO: The following two selector blocks are meant to override the #textfield:hover styles.
 * #textfield:hover .input was overriding the disabled border colors in S2 foundations, as well
 * as the border colors when a combobox was focused+hovered.
 */
:host([disabled]) #textfield .input,
:host([disabled]) #textfield:hover .input {
    border-color: var(--mod-combobox-border-color-disabled, var(--spectrum-combobox-border-color-disabled));
}

#textfield:hover .input:focus {
    border-color: var(--mod-combobox-border-color-default, var(--spectrum-combobox-border-color-focus-hover));
}

::slotted([slot="option"]) {
    display: none;
}

.button {
    bottom: 0;
}

[hidden] {
    display: none !important;
}

.visually-hidden {
    border: 0;
    clip: rect(0, 0, 0, 0);
    clip-path: inset(50%);
    height: 1px;
    margin: 0 -1px -1px 0;
    overflow: hidden;
    padding: 0;
    position: absolute;
    width: 1px;
    white-space: nowrap;
}
